package genetic;

import java.util.ArrayList;
import java.util.List;

public class Population {	
	public List<Individual> members;
	
	public Population() {
		members = new ArrayList<Individual>();
	}
	
	public static Population randomPopulation(IndividualFactory fact,int population_size) {
		Population newpop = new Population();
		for (int i = 0; i < population_size; i++){
			newpop.add(fact.randomIndividual());
		}
		return newpop;
	}	

	public void add(Individual b) {
		members.add(b);		
	}
	
	public Individual getAny() {
		return members.get(RandomUtils.between(0, size()-1));
	}
	
	public int size() {
		return members.size();
	}

	
}
